package hospital.serviceImpl;

import java.util.List;

import hospital.dao.StaffDao;
import hospital.model.AppointmentModel;
import hospital.model.DocScheduleModel;
import hospital.model.EmpInfoModel;
import hospital.model.LoginModel;
import hospital.model.PatientInfoModel;
import hospital.model.RecordDetailModel;
import hospital.service.StaffService;

public class StaffServiceImpl implements StaffService {
	private StaffDao staffDao;

	@Override
	public boolean createPatient(LoginModel loginInfo, PatientInfoModel patientInfo) {
		return staffDao.insertCreatePatient(loginInfo, patientInfo);
	}

	public StaffDao getStaffDao() {
		return staffDao;
	}

	public void setStaffDao(StaffDao staffDao) {
		this.staffDao = staffDao;
	}

	@Override
	public List<PatientInfoModel> getPatientResult(long userId, String firstname, String lastname) {
		return staffDao.selectGetPatientResult(userId, firstname, lastname);
	}

	@Override
	public EmpInfoModel getDefaultDoctor(long doctorId) {
		return staffDao.selectGetDefaultDoctor(doctorId);
	}

	@Override
	public List<PatientInfoModel> getAppointPatientResult(long userId, String firstname, String lastname) {
		return staffDao.selectGetAppointPatientResult(userId, firstname, lastname);
	}

	@Override
	public List<EmpInfoModel> getAppointDocResult(long userId, String firstname, String lastname) {
		return staffDao.selectGetAppointDocResult(userId, firstname, lastname);
	}

	@Override
	public List<DocScheduleModel> getDocSchedules(long docId) {
		return staffDao.selectGetDocSchedules(docId);
	}

	@Override
	public boolean createAppointment(AppointmentModel appointment) {
		return staffDao.insertCreateAppointment(appointment);
	}

	@Override
	public List<RecordDetailModel> getRecordDetailList(long patientId) {
		return staffDao.selectGetRecordDetailList(patientId);
	}

	@Override
	public List<DocScheduleModel> getAppointmentList(long appointmentId, long patientId, long doctorId) {
		return staffDao.selectGetAppointmentList(appointmentId, patientId, doctorId);
	}

	@Override
	public boolean updateAppointment(AppointmentModel appointment) {
		return staffDao.updateAppointment(appointment);
	}

	@Override
	public boolean deleteAppointment(long deleteId) {
		return staffDao.deleteAppointment(deleteId);
	}

	@Override
	public boolean updatePatient(PatientInfoModel patientInfo) {
		return staffDao.updatePatient(patientInfo);
	}

	@Override
	public List<PatientInfoModel> getAllPatients() {
		return staffDao.selectGetAllPatients();
	}

	@Override
	public List<RecordDetailModel> searchRecord(long patientId, long recordTimeStart, long recordTimeEnd,
			String diagnosis, String drug, String comment) {
		return staffDao.selectSearchRecord(patientId, recordTimeStart, recordTimeEnd, diagnosis, drug, comment);
	}

	@Override
	public boolean checkAvailability(String email) {
		return staffDao.selectCheckAvailability(email);
	}

	@Override
	public boolean checkSinUnique(String sin) {
		return staffDao.selectCheckSinUnique(sin);
	}

	@Override
	public boolean checkPatientExist(long patientId) {
		return staffDao.selectCheckPatientExist(patientId);
	}

	@Override
	public boolean checkOhipUnique(String ohip) {
		return staffDao.selectCheckOhipUnique(ohip);
	}

	@Override
	public boolean updateUsername(String email, long patientId) {
		return staffDao.updateUsername(email, patientId);
	}

	@Override
	public String checkPassword() {
		return staffDao.selectCheckPassword();
	}

	@Override
	public boolean changePassword(String password) {
		return staffDao.updateChangePassword(password);
	}

}
